import { Mongoose } from 'mongoose'
import { dataSource } from '../config'
import log from '../config/logger'

const mongoose = new Mongoose()
mongoose.connect(dataSource.uri, {
  useNewUrlParser: true,
  useUnifiedTopology: true
})
  .then(() => {
    log.info('mongodb connect success')
  }).catch(err => {
    log.error(err)
  })

export default mongoose
